<?php


class IndexAction extends Action
{

    public function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
        //广告ID
        $id = I('id', 0);

        $advertising = M('advertising');

        $ad_info = $advertising->where(array('advertising_id'=>$id))->find();

        $step_num = $ad_info['step_num'];
        $step_claim = explode("[sc]", $ad_info['step_claim']);
        $step_gift = explode("[sg]", $ad_info['step_gift']);

        for ($i=0; $i < $step_num; $i++) {
            $step[$i] = array('num'=>$i+1, 'claim'=>$step_claim[$i], 'gift'=>$step_gift[$i]);
        }

        $raiders_num = $ad_info['raiders_num'];
        $raiders_explain = explode("[re]", $ad_info['raiders_explain']);
        $raiders_picture = explode("[rp]", $ad_info['raiders_picture']);
        for ($i=0; $i < $raiders_num; $i++) {
            $raiders[$i] = array('num'=>$i+1, 'explain'=>$raiders_explain[$i], 'picture'=>$raiders_picture[$i]);
        }


        $this->assign('ad_info', $ad_info);
        $this->assign('step', $step);
        $this->assign('raiders', $raiders);

        C('LAYOUT_ON',false);
        $this->display();
    }

}


?>